//
//  YBSelectDeptListTableViewCell.m
//  GongXinDangJian
//
//  Created by apple on 17/12/5.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YBSelectDeptListTableViewCell.h"

@interface YBSelectDeptListTableViewCell ()
@property (nonatomic , strong) UILabel * nameLabel;

@property (nonatomic , strong) UIImageView * selectImageView;
@end

@implementation YBSelectDeptListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ybInitMyCell];
    }
    return self;
}

-(void)ybInitMyCell{
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.selectImageView];
    UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(0, ItemHeight * 80 - 1, [UIScreen zj_screenWith], 1)];
    lineView.backgroundColor = [UIColor themeGrayColor];
    [self.contentView addSubview:lineView];
    
}

-(void)setModel:(YBSelectHeadModel *)model
{
    _model = model;
    self.nameLabel.text = [ToolClass returnNoNullStringWithString:model.NAME];
    if (self.isChooseUnit) {
        if ([model.DEPT_LV integerValue] == 4) {
            self.selectImageView.image = [UIImage imageNamed:@"list_select"];
        }
        else{
            self.selectImageView.image = [UIImage imageNamed:@"jiantou_r"];
        }
    }
}



-(UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 30, 0, [UIScreen zj_screenWith] - ItemWidth * 176, ItemHeight * 80) font:16 textColor:[UIColor textBlackColor] text:@""];
    }
    return _nameLabel;
}




-(UIImageView *)selectImageView
{
    if (!_selectImageView) {
        _selectImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen zj_screenWith] - ItemHeight * 74, (ItemHeight * 80 - ItemWidth * 44) / 2, ItemWidth * 44, ItemWidth * 44)];
        _selectImageView.image = [UIImage imageNamed:@"jiantou_r"];
    }
    return _selectImageView;
}


@end
